<template>
  <div class="common-layout">
    <el-container>
      <el-aside class="left">
        <div class="left-nav">
          <h2 class="tit">推荐</h2>
          <ul>
            <li class="TJ">
              <router-link to="/discovermusic/singer">推荐歌手</router-link>
            </li>
            <li>
              <router-link to="/discovermusic/singer/RuZhu">
                入驻歌手
              </router-link>
            </li>
          </ul>
        </div>
        <div class="left-nav">
          <h2 class="tit">华语</h2>
          <ul>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 1, b: 7, c: '华语男歌手' },
                }"
              >
                华语男歌手
              </router-link>
            </li>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 2, b: 7, c: '华语女歌手' },
                }"
              >
                华语女歌手
              </router-link>
            </li>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 3, b: 7, c: '华语组合/乐队' },
                }"
              >
                华语组合/乐队
              </router-link>
            </li>
          </ul>
        </div>
        <div class="left-nav">
          <h2 class="tit">欧美</h2>
          <ul>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 1, b: 96, c: '欧美男歌手' },
                }"
              >
                欧美男歌手
              </router-link>
            </li>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 2, b: 96, c: '欧美女歌手' },
                }"
              >
                欧美女歌手
              </router-link>
            </li>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 3, b: 96, c: '欧美组合/乐队' },
                }"
              >
                欧美组合/乐队
              </router-link>
            </li>
          </ul>
        </div>
        <div class="left-nav">
          <h2 class="tit">日本</h2>
          <ul>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 1, b: 8, c: '日本男歌手' },
                }"
              >
                日本男歌手
              </router-link>
            </li>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 2, b: 8, c: '日本女歌手' },
                }"
              >
                日本女歌手
              </router-link>
            </li>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 3, b: 8, c: '日本组合/乐队' },
                }"
              >
                日本组合/乐队
              </router-link>
            </li>
          </ul>
        </div>
        <div class="left-nav">
          <h2 class="tit">韩国</h2>
          <ul>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 1, b: 16, c: '韩国男歌手' },
                }"
              >
                韩国男歌手
              </router-link>
            </li>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 2, b: 16, c: '韩国女歌手' },
                }"
              >
                韩国女歌手
              </router-link>
            </li>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 3, b: 16, c: '韩国组合/乐队' },
                }"
              >
                韩国组合/乐队
              </router-link>
            </li>
          </ul>
        </div>
        <div class="left-nav">
          <h2 class="tit">其他</h2>
          <ul>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 1, b: 0, c: '其他男歌手' },
                }"
              >
                其他男歌手
              </router-link>
            </li>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 2, b: 0, c: '其他女歌手' },
                }"
              >
                其他女歌手
              </router-link>
            </li>
            <li>
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 3, b: 0, c: '其他组合/乐队' },
                }"
              >
                其他组合/乐队
              </router-link>
            </li>
          </ul>
        </div>
      </el-aside>
      <el-main class="right">
        <div class="right-div">
          <div class="btn">
            <h3 class="title">入驻歌手</h3>
            <router-link to="RuZhu" class="but"> 更多> </router-link>
          </div>
          <ul>
            <li v-for="si in RuZhu" :key="si.id">
              <div class="li-div">
                <router-link :to="{ path: '/artist', query: { id: si.id } }">
                  <img v-lazy="`${si.picUrl}`" alt="" class="image"
                /></router-link>
              </div>
              <p>
                <a href="#" :title="`${si.name}的音乐`" class="p-a">{{
                  si.name
                }}</a>
                <a
                  href="#"
                  :title="`${si.name}的音乐`"
                  class="right-a"
                  :class="`${si.accountId}`"
                >
                </a>
              </p>
            </li>
          </ul>
        </div>
        <div class="right-div">
          <div class="btn">
            <h3 class="title">热门歌手</h3>
          </div>
          <ul>
            <li v-for="si in singerList" :key="si.id">
              <div class="li-div">
                <router-link :to="{ path: '/artist', query: { id: si.id } }">
                  <img v-lazy="`${si.picUrl}`" alt="" class="image"
                /></router-link>
              </div>
              <p>
                <a href="#" :title="`${si.name}的音乐`" class="p-a">{{
                  si.name
                }}</a>
                <a
                  href="#"
                  :title="`${si.name}的音乐`"
                  class="right-a"
                  :class="`${si.accountId}`"
                >
                </a>
              </p>
            </li>
            <li v-for="si in singerLists" :key="si.id" class="xia-li">
              <p>
                <router-link
                  :to="{ path: '/artist', query: { id: si.id } }"
                  :title="`${si.name}的音乐`"
                  class="xia-a"
                  >{{ si.name }}</router-link
                >
                <a
                  href="#"
                  :title="`${si.name}的音乐`"
                  class="right-a2"
                  :class="`${si.accountId}`"
                ></a>
              </p>
            </li>
          </ul>
        </div>
      </el-main>
    </el-container>
  </div>
</template>

<script lang="ts">
export default {
  name: "XSinger",
};
</script>

<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { singerApi, singerRZApi } from "@/api/api/singer";

const singerList = ref<any>([]);
const singerLists = ref<any>([]);
const RuZhu = ref<any>([]);
onMounted(async () => {
  const res = await singerApi();

  singerList.value = res.artists.slice(0, 10);
  singerLists.value = res.artists.slice(10);
  RuZhu.value = res.artists;
  RuZhu.value = RuZhu.value.filter(function (item: any, index: any, arr: any) {
    return item.accountId !== null;
  });
  RuZhu.value = RuZhu.value.slice(0, 10);
});
</script>

<style scoped>
.common-layout {
  width: 980px;
  margin: 0 auto;
}
.left {
  width: 185px;
  padding: 0 10px 40px;
  padding-top: 40px;
  border-left: 1px solid #d3d3d3;
  border-right: 1px solid #d3d3d3;
}
.left-nav {
  width: 160px;
  padding-bottom: 10px;
  margin: 5px 0 0;
  padding-top: 16px;
  border-bottom: 1px solid #d3d3d3;
}

.left li a {
  display: inline-block;
  width: 160px;
  padding-left: 27px;
  font-size: 12px;
  height: 29px;
  line-height: 29px;
  background: url(./image/cbb4e885-fa39-4f4a-9eef-42ed4a9b3fe1.png) no-repeat 0 -30px;
}
.left .TJ a {
  color: red;
  border: 1px solid #d3d3d3;
  background: url(./image/cbb4e885-fa39-4f4a-9eef-42ed4a9b3fe1.png) no-repeat 0
    0px;
}
.tit {
  height: 25px;
  padding-left: 14px;
  font-size: 16px;
}

.right {
  padding: 30px;
  border-right: 1px solid #d3d3d3;
}
.btn {
  height: 40px;
  border-bottom: 2px solid #c20c0c;
}
.right .right-div ul {
  margin: 20px 0 0 -20px;
}
.right .right-div li {
  width: 130px;
  height: 154px;
  display: inline-block;
  overflow: hidden;
  line-height: 2;
  margin-left: 20px;
  margin-bottom: 15px;
}
.title {
  float: left;
  font-size: 24px;
  font-weight: normal;
}
.but {
  float: right;
  font-size: 12px;
  margin-top: 14px;
  color: #666;
}
.li-div {
  width: 130px;
  height: 130px;
  position: relative;
}
.img-a {
  background-position: 0 -680px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.right-div .p-a {
  float: left;
  max-width: 80%;
  font-size: 12px;
}
.right-a {
  margin-top: 5px;
  float: right;
  display: block;
  width: 15px;
  height: 15px;
  background-color: red;
  border-radius: 50%;
}
.right .right-div .list {
  margin-left: 20px;
  border-top: 1px solid red;
}

.right .right-div .list li {
  margin-left: 15px;
  height: 0;
  overflow: visible;
}
.right .right-div .list li .right-a {
  float: left;
}

.image {
  width: 100%;
  height: 100%;
}

.right .right-div .xia-li {
  width: 130px;
  height: 20px;
  display: inline-block;
  overflow: hidden;
  line-height: 2;
  margin-left: 20px;
  margin-bottom: 15px;
}
.right-div .xia-a {
  float: left;
  max-width: 80%;
  font-size: 12px;
}
.right-a2 {
  margin-top: 5px;
  float: left;
  display: block;
  width: 15px;
  height: 15px;
  background-color: red;
  border-radius: 50%;
}
.null {
  display: none;
}
</style>
